home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
what150.zip
/
WHAT.DOC
< prev
next >
Wrap
Text File
|
1990-09-24
|
18KB
|
359 lines
WHAT - Batch file enhancer
Documentation and enhancements by
Tom Peters,
Glendale, WI 53209
Revision History:
October 1989 V1.3 Tom Peters Many new functions
January 1990 V1.4 Tom Peters Extended P (printer) function to return
a character string. Also allowed checking
printer status for LPT1 thru LPT4.
March 1990 V1.45 Tom Peters Fix bug under DR-DOS that made K function
return 0 for directory, instead of 255.
Note: It is likely that other functions will
also exhibit anomalous behavior under DR-DOS.
Only the most rudimentary testing has been
done. If you find other bugs, please report
them to me.
April 3, 1990 V1.47 Tom Peters Fix bug in T function that caused wrong
values from 12:00 to 12:59 in both AM & PM.
September 1990 V1.5 Tom Peters Add G option- timed wait for character input.
WHAT came undocumented, uncopyrighted, and unsupported, with my
assembler. After making extensive modifications, I have decided to make it
available to the rest of the computer community. WHAT has become an almost
indispensable part of my suite of DOS enhancement programs, and I'm sure
that anyone who has to write batch files will also come to find it so.
In brief, WHAT allows you to ask questions during the execution of a
batch file and take specific action based on the reply. But WHAT is NOT
limited to just asking the user for input via the keyboard. It can
also ask DOS questions, like "is printer 2 online and ready?" or "is
there a math coprocessor available?" or "how big is file XYZZY.ZIP?" etc.
Command format:
WHAT x[E] [parms][parms]
In the format above, "x" is a single option letter from the list below.
The "E" parameter, if given, alters the operation of a given
option slightly, e.g. WHAT C gets a character from the keyboard, WHAT CE
does the same with no echo of the character.
Follow the command WHAT with one of the option letters, as below.
The result is that the environment variable %WHAT% is created with the
value listed under the "Environ" column below. Follow the option letter
with an E for the result in the "Extended" column.
Do NOT enter a space between the option letter and the E for extended
functions,if used, IE WHAT SE is correct, WHAT S E is not.
BUT, DO enter a space after the option letter and the "E" if any,
to separate any arguments from the option letter and "E".
This is best seen in the C option (below) when used with the
optional prompt. Example:
WHAT CE "Install now? (Y or N)" YN
In this example, the particular option is "C", the "get a character"
option, the extended function is specified with the "E", a prompt is used
(the text in quotes) and only the "Y" and "N" keys are accepted.
One could allow the user to enter "Y", "N", or ENTER by using a "~" to
represent the ENTER e.g. WHAT CE "Install now? " YN~
WHAT also sets the DOS errorlevel to the value in the "Exit" column,
for most options.
If you enter some invalid data, like asking for the size of a file (F
option) using a filename with wildcards, the number reported will be zero.
Note: Options that have an option for Echo seem to be influenced by the
setting of the DOS batch switch ECHO, e.g. ECHO OFF.
Brief options list:
WHAT V1.50- Batch file enhancer
Command Purpose Argument Environ Exit Extended
--------- ------- -------- ------- ---- --------
C[E] ["prompt"] [chars] Get Allowable Character Character Echo
character characters
Accept a single char from keyboard. Returns tilde ("~") if ENTER is
struck. Echoes the char unless E used. Prompt in quotes is given if
present. If an allowable chars list is used, WHAT beeps and refuses to
proceed until one of those chars is entered. Do not press ENTER after the
character entered.
Options C and G do not allow extended keys, like arrow or function keys.
Command Purpose Argument Environ Exit Extended
--------- ------- -------- ------- ---- --------
G[E] ["prompt"] [chars] Get Allowable Character Character Echo
character characters
Accept a single char from keyboard. Returns tilde ("~") if ENTER is
struck. Echoes the char unless E used. Prompt in quotes is given if
present. If an allowable chars list is used, WHAT beeps and refuses to
proceed until one of those chars is entered. Do not press ENTER after the
character entered. The G option differs from the C option in that it gives
up after 65535 passes thru a loop if no key is ever struck. If this occurs,
WHAT return "TO" for "time out" to the environment. It should also return 0
to the DOS errorlevel but this is not tested.
The timed-wait is done by a crude loop and therefore will run for various
amounts of time on various machines. It waited 20 seconds on my 12 mHz
80286, and roughly 65 seconds on an 9.54 mHz V20 (8088) machine.
Command Purpose Argument Environ Exit Extended
--------- ------- -------- ------- ---- --------
S[E] ["prompt"] Get string None String Length Echo
Get a string from keyboard. Prompt is optional. Extended option suppresses
echo.
Command Purpose Argument Environ Exit Extended
--------- ------- -------- ------- ---- --------
D[E] Check DOS None Major (Major*10) Minor
version +Minor version
Get DOS version running. WHAT D returns portion of DOS version left of
the decimal point. WHAT DE returns the other part.
Command Purpose Argument Environ Exit Extended
--------- ------- -------- ------- ---- --------
E[E] Get environ None Bytes Bytes/10 10 bytes
bytes left bytes in exit
Get number of bytes available in the environment, or number of bytes
divided by 10 (extended).
Command Purpose Argument Environ Exit Extended
--------- ------- -------- ------- ---- --------
F[E] filespec Get file Filespec Kilobytes Ks/10Ks 10Ks in
size (255=directory) exit
Get size of file "filespec" in kb. If Extended, get Kb/10. If the file
is a directory, returns 255. If file nonexistent or exists but is
zero length, returns 0.
Command Purpose Argument Environ Exit Extended
--------- ------- -------- ------- ---- --------
K[E] [driveletter] Get disk Drive Kilobytes Ks/10Ks 10Ks in
space exit
Get space on disk in kbytes. Returns kbytes free, or tens of kbytes
if extended. If file nonexistent, returns 0.
Command Purpose Argument Environ Exit Extended
--------- ------- -------- ------- ---- --------
M[E] Check None Kilobytes Ks/10Ks 10Ks in